#version 450

layout(location=0) in vec3 a_Pos;
layout(location=1) in vec3 a_Normal;

layout(binding=0) uniform UBO {
    mat4 projMat;
    mat4 viewMat;
    mat4 modelMat;
    vec4 viewPos;
    uint skyBoxIndex;
} ubo;

layout(location=0) out vec3 v_Normal;
layout(location=1) out vec3 v_ViewVec;
layout(location=2) out float v_LodBias;
layout(location=3) out float v_SkyBoxIndex;

void main() {
    vec4 worldPos = ubo.modelMat * vec4(a_Pos, 1.0);
    gl_Position = ubo.projMat * ubo.viewMat * worldPos;
    v_Normal = a_Normal;
    v_ViewVec = (worldPos - ubo.viewPos).xyz;
    v_LodBias = ubo.viewPos.w;
    v_SkyBoxIndex = ubo.skyBoxIndex;
}